﻿<%@ Page Language="C#" MasterPageFile="~/movie.master" AutoEventWireup="true" CodeFile="BrowseByCategory.aspx.cs" Inherits="BrowseByCategory" %>

<%@ MasterType VirtualPath="~/movie.master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
    .style1
    {
        width: 100%;
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div id="maincontent">
    <h3>Search Movies By Category</h3>
        <br /><br />
    
    <table cellpadding="3px" cellspacing="3px" class="style1">
        <tr>
            <td colspan="2">Please select a category to search:
            
            </td>
        </tr>
        <tr>
           
            <td >               
                <asp:Button ID="btnByDir" runat="server" Text="Browse By Director" OnClick="btnByDir_Click" />  
                <asp:Button ID="btnByGenr" runat="server" Text="Browse By Genre"  OnClick="btnByGen_Click" />  
            </td>
        </tr>
         <tr>
                    <td class="Message" >
                        <asp:Label runat="server" ID="lblmsg" ></asp:Label>   
                    </td>
           </tr>
        <tr>
        
            <td> 
            
            
                  <asp:GridView ID="gvDirector" runat="server" DataKeyNames="MovieDirID" AutoGenerateColumns="false" Width="40%"
                    AllowPaging="true" PageSize="10" 
                            EmptyDataText="No Data to Display"                              
                            AllowSorting="true"  onrowcommand="gvDirector_RowCommand" OnPageIndexChanging="gvDirector_PageIndexChanging"  >
                           <RowStyle CssClass="GridViewItemTemplateRowStyle" />                   
                        <AlternatingRowStyle CssClass="GridViewAlternateItemTemplateRowStyle"  />
                        <EmptyDataRowStyle CssClass= "GridViewEmptyDataRowStyle"  />
                        <HeaderStyle  CssClass="GridViewHeaderStyle" />
                        <Columns>
                         <asp:TemplateField>
                                 <ItemTemplate>
                                    <asp:HiddenField id ="hdnDirID"  runat="server" Value='<%# Bind("MovieDirID") %>' />
                                 </ItemTemplate>                             
                             </asp:TemplateField>                             
                             <asp:BoundField DataField="DirName" HeaderText ="Director" />                                                            
                                   <asp:CommandField ShowSelectButton="True" NewText="View Movies by This Director" />
                         
                         </Columns>                  
                  </asp:GridView>
                 
            </td>       
        
        </tr>
        <tr>
        
            <td> 
            
            
                  <asp:GridView ID="gvGenre" runat="server" DataKeyNames="MovieGenreID" AutoGenerateColumns="false" Width="40%"
                    AllowPaging="true" PageSize="10" 
                            EmptyDataText="No Data to Display"                              
                            AllowSorting="true"  onrowcommand="gvGenre_RowCommand"  OnPageIndexChanging="gvGenre_PageIndexChanging" >
                           <RowStyle CssClass="GridViewItemTemplateRowStyle" />                   
                        <AlternatingRowStyle CssClass="GridViewAlternateItemTemplateRowStyle"  />
                        <EmptyDataRowStyle CssClass= "GridViewEmptyDataRowStyle"  />
                        <HeaderStyle  CssClass="GridViewHeaderStyle" />
                        <Columns>
                         <asp:TemplateField>
                                 <ItemTemplate>
                                    <asp:HiddenField id ="hdnGenID"  runat="server" Value='<%# Bind("MovieGenreID") %>' />
                                 </ItemTemplate>                             
                             </asp:TemplateField>                             
                             <asp:BoundField DataField="MovieGenre" HeaderText ="Genre" />                                                            
                                   <asp:CommandField ShowSelectButton="True" NewText="View Movies by This Genre" />
                         
                         </Columns>                  
                  </asp:GridView>
                 
            </td>       
        
        </tr>
        
        <tr>
        <td>
         <h3>Selected Listings</h3>
        
        </td>
                 
        </tr>
         <tr>
                    <td class="Message" >
                        <asp:Label runat="server" ID="lblmsg2" ></asp:Label>   
                    </td>
           </tr>
      
        <tr>
           
            <td>
                     <asp:GridView ID="gvSearch" runat="server" DataKeyNames="MovieID" AutoGenerateColumns="false" Width="90%"
                           AllowPaging="true" PageSize="10" 
                            EmptyDataText="No Data to Display"                              
                            AllowSorting="true"  onrowcommand="gvSearch_RowCommand"   >
                           <RowStyle CssClass="GridViewItemTemplateRowStyle" />                   
                        <AlternatingRowStyle CssClass="GridViewAlternateItemTemplateRowStyle"  />
                        <EmptyDataRowStyle CssClass= "GridViewEmptyDataRowStyle"  />
                        <HeaderStyle  CssClass="GridViewHeaderStyle" />
                        <Columns>
                         <asp:TemplateField>
                                 <ItemTemplate>
                                    <asp:HiddenField id ="hdnMovieID"  runat="server" Value='<%# Bind("MovieID") %>' />
                                 </ItemTemplate>                             
                             </asp:TemplateField>                            
                          <asp:ImageField dataimageurlfield="Image" dataimageurlformatstring="images/movieImages/{0}"></asp:ImageField>                                 
                           <asp:BoundField DataField="Name" HeaderText ="Name" />
                             <asp:BoundField DataField="Director" HeaderText ="Director" />
                               <asp:BoundField DataField="Genre" HeaderText ="Genre" />  
                                     <asp:CommandField ShowInsertButton="True" NewText="Add to Queue" ButtonType="Image" NewImageUrl="images/addToCart.jpg"  />
                         
                         </Columns>
                  
                  </asp:GridView>
            </td>
        </tr>
        <tr>
           
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            
            <td>
                &nbsp;</td>
        </tr>
    </table>
    
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightContent" Runat="Server">
</asp:Content>



